<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>店铺营业记录</title>
        <script type="text/javascript" src="/three/lib/jquery/1.9.1/jquery.js"></script>
	<script type="text/javascript" src="/three/lib/layer/2.4/layer.js"></script>
	<script type="text/javascript" src="/three/static/formEdit.js"></script>
	<script type="text/javascript" src="/three/static/h-ui/js/H-ui.min.js"></script>
	<script type="text/javascript"
		src="/three/static/h-ui.admin/js/H-ui.admin.js"></script>
	<script type="text/javascript"
		src="/three/lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript"
		src="/three/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="/three/lib/laypage/1.2/laypage.js"></script>
    </head>
    <body>
    <!--
    	作者：offline
    	时间：2018-10-24
    	描述：综合查询表单开始
    -->
    <form action="/three/bus/list?active=shop&shopId=${shopId }" method="post" >
    	<table class="table">
    		<tr>
    			<td>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon">订单编号</span>
							<input class="form-control" type="text" name="orderId" style="width: 95px;">
						</div>
					</div>
				</td>
				
				<td>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon">顾客账号</span>
							<input class="form-control" type="text" name="customUserId" style="width: 95px;">
						</div>
					</div>
				</td>
				
				
				<td>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon">顾客姓名</span>
							<input class="form-control" type="text" name="shopname" style="width: 95px;">
						</div>
					</div>

				</td>
				
				
				<td rowspan="2">
					<div class="form-group">
						<div class="input-group">
							<span class="input-group-addon">订单状态</span>
							<select class="form-control" name="orderStatus" style="width: 9px;">
									<option value="">请选择</option>	
									<option value="1" >草稿</option>
									<option value="2" >已预约</option>
									<option value="3" >服务中</option>
									<option value="4" >待支付</option>
									<option value="5" >已支付</option>
									<option value="6" >已完成</option>
									<option value="7" >已过期</option>
									<option value="8" >已撤销</option>
								</select>
						</div>
					</div>

				</td>
				
				<td rowspan="2">
					<div class="form-group col-lg-12">
						<div class="input-group">
							<input type="submit" class="btn btn-primary" value="查询" id="cx_btn" />
						</div>
						</div>
				</td>
				
    		</tr>
    		
    	<tr>
    		<td>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon">支付方式</span>
							<select class="form-control" name="payWay" style="width: 95px;">
								<option value="" >请选择</option>
								<option value="1" >微信</option>	
								<option value="2" >支付宝</option>	
								<option value="3" >美颜币</option>	
								<option value="4" >套餐</option>	
							</select>
						</div>
					</div>
				</td>
				
			<td>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon">店铺名称</span>
							<select class="form-control" name="shopName" style="width: 95px;">
								<option value="${bisShop.shopId }">${bisShop.shopName}</option>
							</select>
						</div>
					</div>
				</td>
				
		<td>
					<div class="form-group col-lg-12">
						<div class="input-group">
							<span class="input-group-addon">完成日期</span>
							<input type="date" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" name="finishTime" id="datemin" value="" style="width: 95px;" />至
							<input type="date" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" name="datemin" id="finishTime" value="" style="width: 95px;"/>
						</div>
					</div>
				</td>		
    		
    	</tr>	
    		
    	</table>	
    </form>
    <br />
    
    <button type="button" class="btn btn-info" id="out_btn" onclick="method5('tableExcel')">📁导出Excel</button>
		<!--主页面开始-->
		<table class='table table-bordered  table-condensed table-hover' id="tableExcel">
			<tr align="center" bgcolor="#C4E3F3">
				<td>订单编号</td>
				<td>顾客账号</td>
				<td>顾客姓名</td>
				<td>消费内容</td>
				<td>价格(元)</td>
				<td>支付方式</td>
				<td>实付金额(元)</td>
				<td>消耗颜值</td>
				<td>店铺编号</td>
				<td>店铺名称</td>
				<td>服务员工</td>
				<td>最后操作员工</td>
			</tr>
			<c:forEach items="${list}" var="business">
					<tr class="text-c">
					<td>${business.orderId }</td>
					<td>${business.bisCustomUser.phone }</td>
					<td>${business.bisCustomUser.username}</td>
					<td>${business.orderType}</td>
					<td>${business.orderMoney}</td>
					<td>
					 <c:if test="${business.payWay=='1'}">
					  微信
					 </c:if>
					 <c:if test="${business.payWay=='2'}">
					  支付宝
					 </c:if>
					 <c:if test="${business.payWay=='3'}">
					  美颜币
					 </c:if>
					 <c:if test="${business.payWay=='4'}">
					  套餐
					 </c:if>
					</td>
					<td>${business.payMoney}</td>
					<td>${business.extendBeautyNum}</td>
					<td>${business.bisShop.shopId}</td>
					<td>${business.bisShop.shopName}</td>
					<td>${business.serverUserId}</td>
					<td>${business.handleUserId}</td>
					</tr>
					</c:forEach>
		</table>
		
		<!--主页面结束-->
    
    
 	</body>
 	<script type="text/javascript">
   var idTmr;  
        function  getExplorer() {
            var explorer = window.navigator.userAgent ;              
            if (explorer.indexOf("MSIE") >= 0) {  
                return 'ie';  
            }
            else if (explorer.indexOf("Firefox") >= 0) {  
                return 'Firefox';  
            }  
            else if(explorer.indexOf("Chrome") >= 0){  
                return 'Chrome';  
            }   
            else if(explorer.indexOf("Opera") >= 0){  
                return 'Opera';  
            }  
            else if(explorer.indexOf("Safari") >= 0){  
                return 'Safari';  
            }  
        }  
        function method5(tableid) {
            if(getExplorer()=='ie')  
            {  
                var curTbl = document.getElementById(tableid);  
                var oXL = new ActiveXObject("Excel.Application");  
                var oWB = oXL.Workbooks.Add();  
                var xlsheet = oWB.Worksheets(1);  
                var sel = document.body.createTextRange();  
                sel.moveToElementText(curTbl);  
                sel.select();  
                sel.execCommand("Copy");  
                xlsheet.Paste();  
                oXL.Visible = true;  

                try {  
                    var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");  
                } catch (e) {  
                    print("Nested catch caught " + e);  
                } finally {  
                    oWB.SaveAs(fname);  
                    oWB.Close(savechanges = false);  
                    oXL.Quit();  
                    oXL = null;  
                    idTmr = window.setInterval("Cleanup();", 1);  
                }  

            }  
            else  
            {  
                tableToExcel(tableid)  
            }  
        }  
        function Cleanup() {  
            window.clearInterval(idTmr);  
            CollectGarbage();  
        }  
        var tableToExcel = (function() {  
            var uri = 'data:application/vnd.ms-excel;base64,',  
                    template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>',  
                    base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) },  
                    format = function(s, c) {  
                        return s.replace(/{(\w+)}/g,  
                                function(m, p) { return c[p]; }) }  
            return function(table, name) {  
                if (!table.nodeType) table = document.getElementById(table)  
                var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}  
                window.location.href = uri + base64(format(template, ctx))  
            }  
        })()  
    </script>
</html>
